<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="/res/css/amazeui.min.css" />
		<link rel="stylesheet" href="/res/css/admin.css" />
	</head>

	<body>
		<div class="admin-content-body">
			<div class="am-cf am-padding am-padding-bottom-0">
				<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">企业信息</strong><small></small></div>
			</div>

			<hr>

			<div class="am-g">
				<div class="am-u-sm-12 am-u-md-6">
					<div class="am-btn-toolbar">
						<div class="am-btn-group am-btn-group-xs">
							<button type="button" class="am-btn am-btn-default" onclick="window.location.href='/company_add'"><span class="am-icon-plus"></span> 新增</button>
						</div>
					</div>
				</div>
				<div class="am-u-sm-12 am-u-md-3">

				</div>
				<div class="am-u-sm-12 am-u-md-3">
					<form class="am-form" method="get" action="/company/view/search">
						<div class="am-input-group am-input-group-sm">
							<input type="text" name="key" class="am-form-field" placeholder="请输入公司名称" />
							<span class="am-input-group-btn">
								<button class="am-btn am-btn-default" type="submit">搜索</button>
							</span>
						</div>
					</form>
				</div>
			</div>
			<div class="am-g">
				<div class="am-u-sm-12">
					<form class="am-form">
						<table class="am-table am-table-striped am-table-hover table-main">
							<thead>
								<tr>
									<th class="table-title">名称</th>
									<th class="table-type">服务行业</th>
									<th class="table-author am-hide-sm-only">联系人</th>
									<th class="table-author am-hide-sm-only">联系电话</th>
									<th class="table-author am-hide-sm-only">联系地址</th>
									<th class="table-author am-hide-sm-only">邮箱地址</th>
									<th class="table-set">操作</th>
								</tr>
							</thead>
							<tbody>
								<tr th:each="item : ${ list }">
									<td th:text="${item.name}"></td>
									<td th:text="${item.serviceTrade}"></td>
									<td th:text="${item.contact}"></td>
									<td th:text="${item.phone}"></td>
									<td th:text="${item.address}"></td>
									<td th:text="${item.email}"></td>
									<td>
										<div class="am-btn-toolbar">
											<div class="am-btn-group am-btn-group-xs">
												<a class="am-btn am-btn-default am-btn-xs am-text-secondary" th:href="${'/company/pc/edit?id='+item.id}" ><span class="am-icon-pencil-square-o"></span> 编辑</a>
												<button class="btn-danger" th:onclick="del([[${item.id}]])"><span class="am-icon-trash-o"></span> 删除</button>
											</div>
										</div>
									</td>
								</tr>

							</tbody>
						</table>
						<div class="am-cf">
							共 <span th:text="${total}"></span> 条记录
							<div class="am-fr">
								<ul class="am-pagination" th:if="${pages>1}">
									<li><a th:href="${ pageNum-1<1 ? '/company/view/list?pageNum='+1 : '/company/view/list?pageNum='+ (pageNum-1) }">&laquo;</a></li>
									<li th:each="i : ${ #numbers.sequence(1,pages) }" th:class="${ i==pageNum ? 'am-active':'' }"><a th:href="${'/company/view/list?pageNum='+i}" th:text="${i}"></a></li>
									<li><a th:href="${ pageNum+1 > total ? '/company/view/list?pageNum=' + total : '/company/view/list?pageNum=' + (pageNum+1) }">&raquo;</a></li>
								</ul>
							</div>
						</div>
						<hr>
					</form>
				</div>
			</div>
		</div>
	</body>
	<script>
		function del(id) {
			if(confirm("是否确认删除？")){
                window.location.href = '/company/pc/del?id='+id;
                window.event.returnValue=false;
			}else {
			    alert("已取消删除");
			}
        }
	</script>
</html>